package com.example.sjkks.mapper;

import com.example.sjkks.entity.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TeacherMapper {

    @Select("SELECT * FROM teacher")
    List<Teacher> findAll();

    @Select("SELECT * FROM teacher WHERE id = #{id}")
    Teacher findById(@Param("id") String id); // 使用 id 字段

    @Insert("INSERT INTO teacher (id, pw) VALUES (#{id}, #{pw})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void save(Teacher teacher);
}
